//问题列表
var isover=0;
var username;//用户中文名
var currentIndex=1;//页码
var ajaxover=0;//控制页面滚动 0不能滚动
$().ready(function(){
    $.cookie("fqscrollTop",0);
    $.ajax({
        type: "post",
        datatype: "json",
        url: userurl,
        data:{"userId":id},
        success:function(data){
            username=data.Data.nick;
            aj();
        }
    });
});
//问题列表------------------------------------------------------------------
var ajaxrunning="no";
function aj(){
    if(isover===0){
        ajaxrunning="yes";
        $.ajax({
            type:"get",
            datatype: "json",
            url: myquestionurl+"?userId="+id+"&pageSize=15&currentIndex="+currentIndex,
            success:function(data){
                console.log(data);
                if(data.Message==="没有数据"){
                    isover=1;//没有数据了
                    $("#waiting").css("display","none");
                    $("#nonews").css("display","block");
                }else{
                    if(data.Data&&data.Data.length>0){
                        if(data.Data.length<15){
                            $("#waiting").css("display","none");
                            $("#nonews").css("display","block");
                        }

                        var num=0;
                        for(var i=0;i<data.Data.length;i++){
                            num++;
                            if(num===data.Data.length){
                                ajaxrunning="no";
                            }

                            //var reg=/([A-Za-z0-9\u4E00-\u9FA5])*/;

                            var tim=data.Data[i].cTime.match(/([0-9\-]+)/)[0];
                            if(data.Data[i].cTime){
                                tim=getDateDiff(getDateTimeStamp(data.Data[i].cTime));
                            };
                            var count=0;
                            if(data.Data[i].browseCount){count=data.Data[i].browseCount;}
                            var nimingimg="";
                            if(data.Data[i].isHideName===1){
                                nimingimg="<img class='rt' src='img/niming.png'>"
                            }
                            if(data.Data[i].status===1){
                                if(data.Data[i].answerCount>0){ //如果有回答
                                    $("#questionlist").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+username+"</span><span class='job'></span>·"+tim+nimingimg+"</div><h2><a class='question_link' href='questiondetail.html?qid="+data.Data[i].id+"'>"+data.Data[i].title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"回答 "+data.Data[i].answerCount+"</div><div class='ActionBar Question'><a class='WriteAnswer Button gofinish' data-score='"+data.Data[i].score+"' data-qid='"+data.Data[i].id+"' data-count='"+data.Data[i].answerCount+"' onclick='gofinish(this)'>去结帖</a></div></div></div>")
                                }else if(data.Data[i].answerCount==0){
                                    $("#questionlist").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+username+"</span><span class='job'></span>·"+tim+nimingimg+"</div><h2><a class='question_link' href='questiondetail.html?qid="+data.Data[i].id+"'>"+data.Data[i].title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"回答 "+data.Data[i].answerCount+"</div><div class='ActionBar Question'><a class='WriteAnswer Button gofinish' data-score='"+data.Data[i].score+"' data-qid='"+data.Data[i].id+"' data-count='"+data.Data[i].answerCount+"' onclick='gofinish(this)' style='background-color:#F9F9F9;color:#999;'>去结帖</a></div></div></div>")
                                }

                            }
                            if(data.Data[i].status===0){
                                $("#questionlist").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+username+"</span><span class='job'></span>·"+tim+nimingimg+"</div><h2><a class='question_link' href='questiondetail.html?qid="+data.Data[i].id+"' id='q"+data.Data[i].id+"'>"+data.Data[i].title+"</a></h2><div class='ContentFooter QuestionFooter'>回答 "+data.Data[i].answerCount+"</div><div class='ActionBar Question'><a class='WriteAnswer Button btndisabled'>已结帖</a></div></div></div>")
                            }
                        }
                        ajaxover=1;
                    }else{
                        $("#waiting").css("display","none");
                        $("#nonews").css("display","block");
                    }
                }
            }
        })
    }
}
//结贴功能
var havemoney=0;//问题又没有钱 0没有 1有
var questionid="";
var gofinishcurrentIndex=1;
var questioncount=0;//问题详情所需数据
var questionscore=0;
var clicknum=0;//点击次数 选择的人的个数
function gofinish(e){
    //保存cookies
    console.log("currentIndex"+currentIndex);
    var scrollTop=$(window).scrollTop();
    $.cookie("fqscrollTop",scrollTop);
    //console.log(scrollTop);
    //console.log($.cookie("fqscrollTop"));
    questionid=e.dataset.qid;
    questioncount=e.dataset.count;
    questionscore=e.dataset.score;
    if(questioncount>0){
        $.ajax({
            type:"get",
            datatype:"json",
            url:getanswerurl+(questionid)+"&currentIndex=1&pageSize=15&userId="+id,
            success:function(d){
                console.log("回答者");
                console.log(d);
                $("#newsplace div").remove();
                document.getElementById("choicepeople").style.display="block";
                document.getElementById("page_wrapper").style.display="none";
                //如果有分数
                if(questionscore>0){
                    havemoney=1;
                    for(var i=0;i< d.Data.PuluanswerExt.length;i++){
                        //if(d.Data.PuluanswerExt[i].user.userId!=id){
                        var answerword=codetoface(d.Data.PuluanswerExt[i].answer.content);
                        $("#newsplace").append("<div class='ts_cells'> <div class='Cell'> <div class='tc_image'> <img  src='"+imgurl+d.Data.PuluanswerExt[i].user.userAva+"'/> </div> <div class='tc_inner newsplaceright'> <div class='tc_text title'>"+d.Data.PuluanswerExt[i].user.nick+"</div> <div class='tc_text words'>"+answerword+"</div> <div class='choiceimg' data-speaker='"+d.Data.PuluanswerExt[i].user.userId+"'> <img src='img/hook-no.png' class='imgno' style='display: block;'/> <img src='img/hook01.png' class='imgyes' data-id='"+d.Data.PuluanswerExt[i].answer.id+"' style='display: none'/> </div> </div> </div> </div><div class='action_menu_container' style='display:none;'> <div class='inner'> <div class='action_menu' style='margin-top: 100px;'> <a class='mweb_action_button cancelmoney'>请输入分配比例</a><a class='mweb_action_button deletekey'><div class='wordinputbox'> <input type='text' maxlength='3' class='inputkey' value='100' min='1' max='100'></div> %</a> <a class='mweb_action_button'><span class='cancel'>取消</span><span class=' sendword' data-id='"+d.Data.PuluanswerExt[i].answer.id+"'>确定</span></a></div> </div> </div>");
                        //}
                    }
                    var clickbtn=document.getElementsByClassName("choiceimg");//选择按钮
                    var imgno=document.getElementsByClassName("imgno");//红图标
                    var imgyes=document.getElementsByClassName("imgyes");//绿图标
                    var inputbox=document.getElementsByClassName("action_menu_container");//弹出输入框
                    var sendword=document.getElementsByClassName("sendword");//弹出输入框确定按钮
                    var cancel=document.getElementsByClassName("cancel");//弹出输入框取消按钮
                    var inputkey=document.getElementsByClassName("inputkey");//弹出输入框input
                    for(var r=0;r<clickbtn.length;r++){
                        clickbtn[r].index=r;
                        clickbtn[r].onclick=function(){
                            if(clickbtn[this.index].dataset.speaker===id){
                                alert("请勿选择自己");
                            }else{
                                if(imgno[this.index].style.display==="block"&&clicknum<3){
                                    clicknum++;
                                    var me=this.index;
                                    imgyes[this.index].style.display="block";
                                    imgno[this.index].style.display="none";
                                    inputbox[this.index].style.display="block";
                                    var last=0;//输入多少钱
                                    sendword[me].onclick=function(){
                                        //console.log("dianji");
                                        imgyes[me].setAttribute( 'data-score' ,inputkey[me].value) ;
                                        //allscore[d.Data[me].answer.id]=parseFloat(inputkey[me].value)/100;
                                        inputbox[me].style.display="none";
                                        var choiceimg=document.getElementsByClassName("imgyes");
                                        var tim=0;
                                        for(var r= 0,len=choiceimg.length;r<len;r++){
                                            tim++;
                                            if(choiceimg[r].dataset.score){
                                                last+=parseFloat(choiceimg[r].dataset.score);
                                            };
                                            console.log("tim"+tim);
                                            if(tim==len){
                                                console.log("眼睛图片遍历结束");
                                                var lastinput=document.getElementsByClassName("inputkey");//弹出输入框input
                                                for(var l= 0,len2=lastinput.length;l<len2;l++){
                                                    console.log("修改value");
                                                    lastinput[l].value=100-last;
                                                }
                                            }
                                        }
                                    };
                                    //console.log("clicknum"+clicknum);
                                }
                                else if(imgno[this.index].style.display==="none"){
                                    clicknum--;
                                    imgyes[this.index].style.display="none";
                                    imgyes[this.index].dataset.score="";
                                    imgno[this.index].style.display="block";
                                    //console.log("clicknum"+clicknum);
                                    var last=0;//输入多少钱
                                    var choiceimg=document.getElementsByClassName("imgyes");
                                    var tim=0;
                                    for(var r= 0,len=choiceimg.length;r<len;r++){
                                        tim++;
                                        if(choiceimg[r].dataset.score){
                                            last+=parseFloat(choiceimg[r].dataset.score);
                                        };
                                        if(tim==len){
                                            var lastinput=document.getElementsByClassName("inputkey");//弹出输入框input
                                            for(var l= 0,len2=lastinput.length;l<len2;l++){
                                                console.log("取消操作后value");
                                                lastinput[l].value=100-last;
                                            }
                                        }
                                    }
                                }
                            }

                        }
                    }
                    //弹出输入框取消按钮
                    for(var r2=0;r2<cancel.length;r2++){
                        cancel[r2].index=r2;
                        cancel[r2].onclick=function(){
                            clicknum--;
                            imgyes[this.index].style.display="none";
                            imgno[this.index].style.display="block";
                            inputbox[this.index].style.display="none";
                        };
                        console.log("clicknum"+clicknum);
                    }
                }else{  /////////////////////////////////////////////////////////////////////没有分数
                    for(var i=0;i< d.Data.PuluanswerExt.length;i++){
                        //if(d.Data.PuluanswerExt[i].user.userId!=id){
                        var answerword=codetoface(d.Data.PuluanswerExt[i].answer.content);
                        $("#newsplace").append("<div class='ts_cells'> <div class='Cell'> <div class='tc_image'> <img  src='"+imgurl+d.Data.PuluanswerExt[i].user.userAva+"'/> </div> <div class='tc_inner newsplaceright'> <div class='tc_text title'>"+d.Data.PuluanswerExt[i].user.nick+"</div> <div class='tc_text words'>"+answerword+"</div><div class='choiceimg' data-speaker='"+d.Data.PuluanswerExt[i].user.userId+"'><img src='img/hook-no.png' class='imgno' style='display: block;'/> <img src='img/hook01.png' class='imgyes' data-id='"+d.Data.PuluanswerExt[i].answer.id+"' style='display: none'/> </div> </div> </div> </div></div> </div>");
                        //}
                    }
                    $('.action_menu .inputkey').bind('input propertychange', function(e) {
                        //包含其他字符
                        if(!/^[0-9]+$/.test(e.target.value)){
                            e.target.value=e.target.value.replace(/[^0-9]/ig,"");
                        }
                        if(e.target.value){
                            if(parseFloat(e.target.value)>100){
                                e.target.value=100;
                            }else{
                                e.target.value=parseFloat(e.target.value);
                            }
                        }
                    });
                    var clickbtn=document.getElementsByClassName("choiceimg");//选择按钮
                    var imgno=document.getElementsByClassName("imgno");//红图标
                    var imgyes=document.getElementsByClassName("imgyes");//绿图标
                    for(var r=0;r<clickbtn.length;r++){
                        clickbtn[r].index=r;
                        clickbtn[r].onclick=function(){
                            if(clickbtn[this.index].dataset.speaker===id){
                                alert("请勿选择自己");
                            }
                            else{
                                if(imgno[this.index].style.display==="block"&&clicknum<3){
                                    clicknum++;
                                    var me=this.index;
                                    imgyes[this.index].style.display="block";
                                    imgno[this.index].style.display="none";
                                    //console.log("clicknum"+clicknum);
                                }else if(imgno[this.index].style.display==="none"){
                                    clicknum--;
                                    imgyes[this.index].style.display="none";
                                    imgno[this.index].style.display="block";
                                    //console.log("clicknum"+clicknum);
                                }
                            }

                        }
                    }
                }
            }
        })
    }
}
function getallanswer(questionid){
    $.ajax({
        type:"get",
        datatype:"json",
        url:getanswerurl+(questionid)+"&currentIndex="+gofinishcurrentIndex+"&pageSize=15&userId="+id,
        success:function(d){
            console.log("回答者");
            console.log(d);
            document.getElementById("choicepeople").style.display="block";
            document.getElementById("page_wrapper").style.display="none";
            //如果有分数
            if(questionscore>0){
                havemoney=1;
                for(var i=0;i< d.Data.PuluanswerExt.length;i++){
                    //if(d.Data.PuluanswerExt[i].user.userId!=id){
                    var answerword=codetoface(d.Data.PuluanswerExt[i].answer.content);
                    $("#newsplace").append("<div class='ts_cells'> <div class='Cell'> <div class='tc_image'> <img  src='"+imgurl+d.Data.PuluanswerExt[i].user.userAva+"'/> </div> <div class='tc_inner newsplaceright'> <div class='tc_text title'>"+d.Data.PuluanswerExt[i].user.nick+"</div> <div class='tc_text words'>"+answerword+"</div> <div class='choiceimg' data-speaker='"+d.Data.PuluanswerExt[i].user.userId+"'> <img src='img/hook-no.png' class='imgno' style='display: block;'/> <img src='img/hook01.png' class='imgyes' data-id='"+d.Data.PuluanswerExt[i].answer.id+"' style='display: none'/> </div> </div> </div> </div><div class='action_menu_container' style='display:none;'> <div class='inner'> <div class='action_menu' style='margin-top: 100px;'> <a class='mweb_action_button deletekey'> <div>请输入分配比例</div> <div class='wordinputbox'> <input type='text' maxlength='3' class='inputkey' value='100' min='1' max='100'></div> %</a> <a class='mweb_action_button'><span class='cancel'>取消</span><span class=' sendword' data-id='"+d.Data.PuluanswerExt[i].answer.id+"'>确定</span></a></div> </div> </div>");
                    //}
                }
                //输入内容监听
                $('.action_menu .inputkey').bind('input propertychange', function(e) {
                    //包含其他字符
                    if(!/^[0-9]+$/.test(e.target.value)){
                        e.target.value=e.target.value.replace(/[^0-9]/ig,"");
                    }
                    if(e.target.value){
                        if(parseFloat(e.target.value)>100){
                            e.target.value=100;
                        }else if(e.target.value==0){
                            e.target.value=1;
                        }else{
                            e.target.value=parseFloat(e.target.value);
                        }
                    }
                });
                var clickbtn=document.getElementsByClassName("choiceimg");//选择按钮
                var imgno=document.getElementsByClassName("imgno");//红图标
                var imgyes=document.getElementsByClassName("imgyes");//绿图标
                var inputbox=document.getElementsByClassName("action_menu_container");//弹出输入框
                var sendword=document.getElementsByClassName("sendword");//弹出输入框确定按钮
                var cancel=document.getElementsByClassName("cancel");//弹出输入框取消按钮
                var inputkey=document.getElementsByClassName("inputkey");//弹出输入框input
                for(var r=0;r<clickbtn.length;r++){
                    clickbtn[r].index=r;
                    clickbtn[r].onclick=function(e){
                        if(clickbtn[this.index].dataset.speaker===id){
                            alert("请勿选择自己");
                        }else{
                            if(imgno[this.index].style.display==="block"&&clicknum<3){
                                clicknum++;
                                var me=this.index;
                                imgyes[this.index].style.display="block";
                                imgno[this.index].style.display="none";
                                inputbox[this.index].style.display="block";
                                var last=0;//输入多少钱
                                sendword[me].onclick=function(){
                                    //console.log("dianji");
                                    imgyes[me].setAttribute( 'data-score' ,inputkey[me].value) ;
                                    //allscore[d.Data[me].answer.id]=parseFloat(inputkey[me].value)/100;
                                    inputbox[me].style.display="none";
                                    var choiceimg=document.getElementsByClassName("imgyes");
                                    var tim=0;
                                    for(var r= 0,len=choiceimg.length;r<len;r++){
                                        tim++;
                                        if(choiceimg[r].dataset.score){
                                            last+=parseFloat(choiceimg[r].dataset.score);
                                        };
                                        console.log("tim"+tim);
                                        if(tim==len){
                                            console.log("眼睛图片遍历结束");
                                            var lastinput=document.getElementsByClassName("inputkey");//弹出输入框input
                                            for(var l= 0,len2=lastinput.length;l<len2;l++){
                                                console.log("修改value");
                                                lastinput[l].value=100-last;
                                            }
                                        }
                                    }
                                };
                                //console.log("clicknum"+clicknum);
                            }
                            else if(imgno[this.index].style.display==="none"){
                                clicknum--;
                                imgyes[this.index].style.display="none";
                                imgyes[this.index].dataset.score="";
                                imgno[this.index].style.display="block";
                                //console.log("clicknum"+clicknum);
                                var last=0;//输入多少钱
                                var choiceimg=document.getElementsByClassName("imgyes");
                                var tim=0;
                                for(var r= 0,len=choiceimg.length;r<len;r++){
                                    tim++;
                                    if(choiceimg[r].dataset.score){
                                        last+=parseFloat(choiceimg[r].dataset.score);
                                    };
                                    if(tim==len){
                                        var lastinput=document.getElementsByClassName("inputkey");//弹出输入框input
                                        for(var l= 0,len2=lastinput.length;l<len2;l++){
                                            console.log("取消操作后value");
                                            lastinput[l].value=100-last;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //弹出输入框取消按钮
                for(var r2=0;r2<cancel.length;r2++){
                    cancel[r2].index=r2;
                    cancel[r2].onclick=function(){
                        clicknum--;
                        imgyes[this.index].style.display="none";
                        imgno[this.index].style.display="block";
                        inputbox[this.index].style.display="none";
                    };
                    console.log("clicknum"+clicknum);
                }
            }else{  /////////////////////////////////////////////////////////////////////没有分数
                for(var i=0;i< d.Data.PuluanswerExt.length;i++){
                    //if(d.Data.PuluanswerExt[i].user.userId!=id){
                    var answerword=codetoface(d.Data.PuluanswerExt[i].answer.content);
                    $("#newsplace").append("<div class='ts_cells'> <div class='Cell'> <div class='tc_image'> <img  src='"+imgurl+d.Data.PuluanswerExt[i].user.userAva+"'/> </div> <div class='tc_inner newsplaceright'> <div class='tc_text title'>"+d.Data.PuluanswerExt[i].user.nick+"</div> <div class='tc_text words'>"+answerword+"</div> <div class='choiceimg' data-speaker='"+d.Data.PuluanswerExt[i].user.userId+"'> <img src='img/hook-no.png' class='imgno' style='display: block;'/> <img src='img/hook01.png' class='imgyes' data-id='"+d.Data.PuluanswerExt[i].answer.id+"' style='display: none'/> </div> </div> </div> </div></div> </div>");
                    //}
                }
                var clickbtn=document.getElementsByClassName("choiceimg");//选择按钮
                var imgno=document.getElementsByClassName("imgno");//红图标
                var imgyes=document.getElementsByClassName("imgyes");//绿图标
                for(var r=0;r<clickbtn.length;r++){
                    clickbtn[r].index=r;
                    clickbtn[r].onclick=function(e){
                        if(clickbtn[this.index].dataset.speaker===id){
                            alert("请勿选择自己");
                        }
                        else{
                            if(imgno[this.index].style.display==="block"&&clicknum<3){
                                clicknum++;
                                var me=this.index;
                                imgyes[this.index].style.display="block";
                                imgno[this.index].style.display="none";
                                console.log("clicknum"+clicknum);
                            }else if(imgno[this.index].style.display==="none"){
                                clicknum--;
                                imgyes[this.index].style.display="none";
                                imgno[this.index].style.display="block";
                                console.log("clicknum"+clicknum);
                            }
                        }
                    }
                }
            }
        }
    })
}
//返回键 取消closethispagebtn
$("#closethispagebtn").click(function(){
    clicknum=0;
    ajaxover=1;
    console.log("关闭页面");
    document.getElementById("choicepeople").style.display="none";
    document.getElementById("page_wrapper").style.display="block";
    var t=parseFloat($.cookie("fqscrollTop"));
    //console.log(t);
    //$("#questionlist").scrollTop(t);
    //$("#page_wrapper").scrollTop(t);//mainpage
    //$("#mainpage").scrollTop(t);
    //$("#questionlist").scrollTop(t);
    window.scrollTo(0,t)
});
//完成 页面返回
$("#peoplefinish").click(function(){
    var answerData = [];
    var allmoney=0;
    var imgyes=document.getElementsByClassName("imgyes");//绿图标
    if(imgyes){
        if(havemoney===0){
            for(var i=0;i<imgyes.length;i++){
                if(imgyes[i].style.display==="block"){
                    var obj = {};
                    obj.answerId =imgyes[i].dataset.id;
                    obj.scorerate =0;
                    answerData.push(obj);
                    allmoney+=parseFloat(imgyes[i].dataset.score);
                }
            }
            $.ajax({
                type:"post",
                datatype:"json",
                url:overquestionurl,
                data:{ "answerData": answerData, "questionId": questionid },
                success:function(d){
                    console.log(d);
                    havemoney=0;
                    document.getElementById("choicepeople").style.display="none";
                    document.getElementById("page_wrapper").style.display="block";
                    location.reload();
                    var t=parseFloat($.cookie("fqscrollTop"));
                    console.log(t);
                    $("#questionlist").scrollTop(t);
                }
            })
        }else if(havemoney===1){
            for(var i=0;i<imgyes.length;i++){
                if(imgyes[i].style.display==="block"){
                    var obj = {};
                    obj.answerId =imgyes[i].dataset.id;
                    obj.scorerate =parseFloat(imgyes[i].dataset.score)/100;
                    answerData.push(obj);
                    allmoney+=parseFloat(imgyes[i].dataset.score);
                }
            }
            if(allmoney!=100){
                //金钱提示
                $("#moneynews").css("display","block");
                setTimeout(function(){
                    $("#moneynews").css("display","none");
                },2000);
                clearTimeout();
            }else{
                $.ajax({
                    type:"post",
                    datatype:"json",
                    url:overquestionurl,
                    data:{ "answerData": answerData, "questionId": questionid },
                    success:function(d){
                        console.log(d);
                        havemoney=0;
                        document.getElementById("choicepeople").style.display="none";
                        document.getElementById("page_wrapper").style.display="block";
                        location.reload();
                        var t=parseFloat($.cookie("fqscrollTop"));
                        console.log(t);
                        $("#questionlist").scrollTop(t);
                    }
                })
            }
        }
    }
});

//滚动加载更多
$(window).scroll(function(){
    var mainheight=$(".home_feed").height();
    //console.log("加载区域高度："+mainheight);
    var windowheight=$(window).height();
    //console.log("窗口高度："+windowheight);
    var what=$(".home_feed").offset().top;
    var chajuli=$(".home_feed").offset().top - $(window).scrollTop();
    var cz=windowheight-mainheight+50;
    //console.log("窗口与加载差值："+cz);
    //console.log("差值"+chajuli);
    //console.log("ajaxover",ajaxover);
    if(chajuli<cz&&ajaxover===1&&ajaxrunning==="no"){
        ajaxover=0;
        if(document.getElementById("page_wrapper").style.display==="block"){
            //console.log("页面滚动");
            currentIndex++;
            aj();
        }else if(document.getElementById("choicepeople").style.display="block"){
            gofinishcurrentIndex++;
            getallanswer(questionid);
        }
    }
});
//搜索
document.onkeydown=function(event){
    var e = event || window.event || arguments.callee.caller.arguments[0];
    if(e && e.keyCode==13){ // enter 键
        var word=document.getElementById("searchinput").value;
        if(word){
            if(word.match(/^\s+$/g)){
                console.log("没有填信息")
            }else{
                location.href="search.html?searchKey="+word;
            }
        }
    }
};
document.getElementById("gotosearch").onclick=function(){
    var word=document.getElementById("searchinput").value;
    if(word){
        if(word.match(/^\s+$/g)){
            console.log("没有填信息")
        }else{
            location.href="search.html?searchKey="+word;
        }
    }
};